#include <iostream>
#include <queue>
#include <vector>
#include <string.h>
#define mod 100003
using namespace std;


struct edge{
	int stop,next;
};


int main(){
	int n,m;
	cin>>n>>m;
	int ehead[n];
	memset(ehead,-1,sizeof(ehead));
	edge e[m*2];
	bool vis[n];
	int len[n];
	int ans[n];
	memset(vis,false,sizeof(vis));
	memset(ans,0,sizeof(ans));
	vis[0] = true;
	len[0] = 0;
	ans[0] = 1;
	queue<int> q;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		e[i*2].stop = b;
		e[i*2].next = ehead[a];
		ehead[a] = i*2;
		
		e[i*2+1].stop = a;
		e[i*2+1].next = ehead[b];
		ehead[b] = i*2+1;
//		cin>>a[i].x>>a[i].y;
//		a[i].x--;
//		a[i].y--;
	}
	q.push(0);
	while(!q.empty()){
		int start=q.front();
		q.pop();
		
		int index=ehead[start];
		while(index != -1){
			if(vis[e[index].stop] == true){
				index = e[index].next;
				continue;
			}
			if(ans[e[index].stop] == 0){
				len[e[index].stop] = len[start]+1;
				ans[e[index].stop] += ans[start];
				ans[e[index].stop] %= mod;
				q.push(e[index].stop);
				index = e[index].next;
				continue;
			}
			if(len[e[index].stop] < len[start]+1){
				vis[e[index].stop] = true;
				index = e[index].next;
				continue;
			}
			if(len[e[index].stop] == len[start]+1){
				ans[e[index].stop] += ans[start];
				ans[e[index].stop] %= mod;
				index = e[index].next;
				continue;
			}
		}
	}
	for(int i=0;i<n;i++)
		cout<<ans[i]%mod<<endl;
	return 0;
}
